package com.easthome.controller;

import com.easthome.pojo.Person;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.redis.core.RedisTemplate;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@RestController
@RequestMapping("redis")
public class RedisController {
    @Autowired
    private RedisTemplate redisTemplate;
    @Autowired
    private Person person;

    @RequestMapping("setRedis")
    public void setRedis(){
        redisTemplate.boundValueOps("hello").set("你好Redis");
    }
    @RequestMapping("getRedis")
    public String getRedis(){
        String hello = (String) redisTemplate.boundValueOps("hello").get();
        System.out.println(hello);
        return hello;
    }
}
